Skip to content

Add Electrum connection timeout to prevent thread pool exhaustion#75

Merged
ovitrif merged 1 commit intomainfrom
electrum-connection-fix
Mar 11, 2026
Merged

Add Electrum connection timeout to prevent thread pool exhaustion#75
ovitrif merged 1 commit intomainfrom
electrum-connection-fix

Conversation

@ben-kaufman
Copy link

@ben-kaufman ben-kaufman commented Mar 10, 2026

Summary

Bumps the Synonym Fork to v0.7.0-rc.33 and adds a connection_timeout_secs field to ElectrumSyncConfig (default: 10 s). This bounds Electrum socket operations for both the BDK on-chain and LDK tx-sync clients, preventing Tokio's blocking thread pool from being exhausted by threads stuck on dead sockets under total packet loss (e.g. a captive portal on iOS).

Changes

  • Added connection_timeout_secs: u64 field to ElectrumSyncConfig (default: 10 s). Set to 0 to disable; values above 255 are capped to 255 with a warning logged.

Breaking change: existing struct-literal construction of ElectrumSyncConfig must add the new connection_timeout_secs field or switch to ElectrumSyncConfig { .., ..Default::default() }.

Testing

  • Verify Electrum sync succeeds under normal network conditions.
  • Verify that connecting to a dead/unreachable Electrum server times out within ~10 seconds rather than hanging indefinitely.
  • Verify that setting connection_timeout_secs = 0 disables the timeout.
  • Verify that values above 255 are capped and a warning is logged.
  • Run existing CI test suite across Rust, Kotlin, Swift, and Python bindings.

@ben-kaufman ben-kaufman force-pushed the electrum-connection-fix branch from 034be95 to 831fff1 Compare March 10, 2026 13:34
claude[bot]

This comment was marked as outdated.

Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ovitrif ovitrif merged commit d1d6fff into main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants